<%--
  Created by IntelliJ IDEA.
  User: Root404
  Date: 2022/7/12
  Time: 10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>欢迎来到分页</h1>
<table border="4">
    <tr>
        <th>id</th>
        <th>name</th>
        <th>sex</th>
        <th>hobby</th>
    </tr>
    <c:forEach items="${list}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.name}</td>
            <td>${user.sex==1?"男":"女"}</td>
            <td>${user.hobby}</td>
        </tr>
    </c:forEach>
</table>
<a href="${pageContext.request.contextPath}/ServletPage?currentPage=1">首页</a>
<a href="${pageContext.request.contextPath}/ServletPage?currentPage=${currentPage-1<=1?1:currentPage-1}" ${currentPage-1<1?"hidden":""}>上一页</a>
<a href="${pageContext.request.contextPath}/ServletPage?currentPage=${currentPage+1>=pages?pages:currentPage+1}" ${currentPage+1>pages?"hidden":""}>下一页</a>
<a href="${pageContext.request.contextPath}/ServletPage?currentPage=${pages}">尾页</a>
<br/>
<span>当前页数/总页数:${currentPage}/${pages}</span>
<span>总条数：${totals}</span> <span>总页数：${pages}</span>
<span>每页展示数：${pageSize}</span>
<form method="get" action="${pageContext.request.contextPath}/ServletPage">
    <input type="text"   name="currentPage" maxlength="60" placeholder="请输入搜索页，默认第一页，最大页是${pages}">
    <input type="text"  name="pageSize" placeholder="请输入每页展示数，默认2">
    <input type="submit" value="查询">
</form>
</body>
</html>
